import service from "@/api/service.js";

// 获取所有的用户
export const getUser = (args) => {
    return service({
        url: "/users",
        params: args,
    })
}

// 改变用户的状态
export const changeUserState = (uId, type) => {
    return service({
        url: `users/${uId}/state/${type}`,
        method: "put"
    })
}

// 增加用户
export const addUser = (data) => {
    return service({
        url: "users",
        method: "post",
        data
    })
}

// 编辑用户
export const editUser = (data) => {
    return service({
        url: `users/${data.value.id}`,
        method: "put",
        data: data.value
    })
}

// 删除用户
export const deleteUser = (id) => {
    return service({
        url: `users/${id}`,
        method: "delete"
    })
}
